package com.shensi.api.admin.client.system;

import com.shensi.api.admin.client.fallback.system.SysProfileClientFallBack;
import com.shensi.common.core.constant.CloudConstant;
import com.shensi.common.core.domain.AjaxResult;
import com.shensi.common.core.domain.entity.SysUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author: budian
 * @since: 2023/11/30
 */
@FeignClient(
        value = CloudConstant.ADMIN_SERVER,
        fallbackFactory = SysProfileClientFallBack.class)
@Component
public interface SysProfileClient {

    /**
     * 个人信息
     */
    @GetMapping
    public AjaxResult profile();

    /**
     * 修改用户
     */
    @PutMapping
    public AjaxResult updateProfile(@RequestBody SysUser user);

    /**
     * 重置密码
     */
    @PutMapping("/updatePwd")
    public AjaxResult updatePwd(@RequestParam("oldPassword") String oldPassword,@RequestParam("newPassword") String newPassword);

    /**
     * 头像上传
     */
    @PostMapping("/avatar")
    public AjaxResult avatar(@RequestParam("file") MultipartFile file);

}
